home *** CD-ROM | disk | FTP | other *** search
- /****** axuucp/rn-subscribe **************************************************
- *
- * NAME
- * rn-subscribe - Subscribe new groups
- *
- * SYNOPSIS
- * rx rn-subscribe.rexx [user]
- *
- * DESCRIPTION
- * This script adds all groups to your ~/.rnnewsrc which are not already
- * listed there. New groups will be subscribed.
- *
- * AUTHOR
- * Tobias Ferber <tf@ganymed.hall.sub.org>
- *
- ******************************************************************************
- *
- */
-
- user = arg(1)
- newsrc = axconfig("home") || user || "/.rnnewsrc"
- axnews = axconfig("news")
- newsgroups = axconfig("newsgroupfile")
- tempfile = "T:rn-subscribe." || pragma('Id')
-
- /**/
-
- call open('fp',newsgroups)
-
- do until eof('fp')
- str= readln('fp')
- if words(str) > 0 then do
- parse var str gname ' ' .
- address command 'search >' tempfile 'from "'newsrc'" search "'gname'" nonum'
- call open('tmp',tempfile); str= readln('tmp'); call close('tmp')
- if words(str) < 1 then do
- say gname 'added'
- address command 'echo >>' newsrc '"'gname':"'
- end
- end
- end
-
- call close('fp')
-
- if exists(tempfile) then address command 'delete quiet' tempfile
- exit
-
-
- /*@<axconfig>*/
-
- /* get an AXsh configuration value */
-
- axconfig: procedure
- tempfile = "T:axconfig." || pragma('Id')
- rc_index = "AXsh:rexx/rc.index"
- var_val=""; var_file=""; var_defval="";
-
- parse upper arg var_name
- if left(var_name,1) ~= '%' then var_name = '%'var_name
- if right(var_name,1) ~= ':' then var_name = var_name':'
-
- if open('idx',rc_index,'Read') then do
- do until (eof('idx') | (var_file~=''))
- str= translate(readln('idx'),' ',d2c(9))
- if words(str) > 0 then do
- parse var str vname ' ' fname '"' defval '"'
- if upper(vname) = var_name then do
- var_file= strip(fname,'B',' 'd2c(9))
- var_defval= defval
- end
- end
- end
- call close('idx')
- end
- else say 'Could not read "'rc_index'"'
-
- if words(var_file) > 0 then do
- if open('rc',var_file,'Read') then do
- do until (eof('rc') | (var_val~=''))
- str= translate(readln('rc'),' ',d2c(9))
- if upper(word(str,1)) = var_name then var_val = strip(readln('rc'),'B',' 'd2c(9))
- end
- call close('rc')
- end
- else say 'Could not examine "'var_file'" for' var_name
- end
- else do
- if words(var_defval) > 0 then var_val= var_defval
- else say 'No such config variable:' var_name
- end
-
- return var_val
-
-